package nrpc.client.serst;

import java.net.InetSocketAddress;

public class AddressServiceNode implements ServiceNode {

	private InetSocketAddress socketAddress;
	
	public AddressServiceNode(String host, int port) {
		this(new InetSocketAddress(host, port));
	}
	
	public AddressServiceNode(InetSocketAddress socketAddress) {
		this.socketAddress = socketAddress;
	}
	
	@Override
	public InetSocketAddress getAddress() {
		return this.socketAddress;
	}

	@Override
	public boolean equals(Object obj) {
		if(obj instanceof AddressServiceNode o) {
			return o.socketAddress.equals(this.socketAddress);
		}
		return false;
	}
	
	@Override
	public int hashCode() {
		return socketAddress.hashCode();
	}
	
}
